package com.example.databindingdemo

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.databinding.DataBindingUtil
import com.example.databindingdemo.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

    var userBean = UserBean(
        "小明",
        12
    )
    lateinit var  mainBinding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mainBinding=DataBindingUtil.setContentView(this,R.layout.activity_main)
        mainBinding.example=userBean

        mainBinding.but.setOnClickListener {
            startActivity(Intent(this,NextActivity::class.java))
        }
    }


}